<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Calendar" %><%--
  Created by IntelliJ IDEA.
  User: Jcdz
  Date: 2019/10/6
  Time: 3:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
    String datetime=new SimpleDateFormat("yyyy-MM-dd").format(Calendar.getInstance().getTime()); //获取系统时间
    request.setAttribute("currentTime",datetime);
%>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>医生详情</title>
    <link rel="stylesheet" href="plugins/bootstrap/css/bootstrap.css" type="text/css">
    <link rel="stylesheet" href="css/head.css">
</head>
<div>
<jsp:include page="../nav/nav.jsp"></jsp:include>
    <div style="height: 300px;width:100%;margin-top: 50px;">
        <div class="row">

            <div class="col-sm-3 col-md-3">
                <div class="thumbnail">
                    <img src="${doctor.pictrue}" alt="通用的占位符缩略图">
                </div>
            </div>
            <div class="col-md-8">
                <h2><b style="color:rgb(151, 161, 92);">姓名</b>: ${doctor.docName}</h2>
                <h2><b style="color:rgb(151, 161, 92);">科室</b>: ${sdepartment.sdeptName}(<c:if test="${doctorType.docType==0}">医师</c:if><c:if test="${doctorType.docType==1}">专家</c:if>)</h2>
                <div
                        style="background-color: rgb(241, 245, 222); height:200px; box-shadow: 0 0 8px rgb(61, 68, 64);">
                    <div style="padding:10px 0px 0px 18px;">
                        <h3><b style="color:rgb(151, 161, 92);">详细介绍</b></h3>
                        <br>
                        <p style="font-size:15px;">
                           ${doctor.docIntro}
                        </p>
                    </div>
                </div>
                <h2><b style="color:rgb(151, 161, 92);">预约时间:(选择时间进行挂号)</b></h2>
                <table class="table">
                    <thead>
                    <c:forEach items="${timeList}" var="t">
                        <c:if test="${t.id%2==1}">
                        <th>
                            <h4>${fn:substring(t.startTimes,0,10)}</h4>
                        </th>
                        </c:if>
                    </c:forEach>
                    </thead>
                    <tbody>
                    <tr>
                        <c:forEach items="${timeList}" var="t">
                            <c:if test="${t.id%2==1}">
                            <c:set var="flag" value="true"/>
                            <c:forEach items="${workTimes}" var="w">
                                <c:if test="${w.timeId==t.id&&w.status==0}">
                                    <c:set var="flag" value="false"/>
                                    <td><button type="button" class="btn btn-info btn-lg"
                                                style="height: 80px;width: 150px" onclick="location.href='/treatment/sendata?did=${doctor.id}&deptId=${sdepartment.deptId}&sid=${sdepartment.id}&tid=${t.id}'">上午<br>${fn:substring(t.startTimes,11,16)}
                                        - ${fn:substring(t.endTime,11,16)}</button></td>
                                </c:if>
                            </c:forEach>
                            <c:if test="${flag}">
                                <td></td>
                            </c:if>
                        </c:if>
                    </c:forEach>

                            <tr>
                        <c:forEach items="${timeList}" var="t">
                            <c:if test="${t.id%2==0}">
                                <c:set var="flag" value="true"/>
                                <c:forEach items="${workTimes}" var="w">
                                    <c:if test="${w.timeId==t.id&&w.status==0}">
                                        <c:set var="flag" value="false"/>
                                        <td><button type="button" class="btn btn-info btn-lg"
                                                    style="height: 80px;width: 150px" onclick="location.href='/treatment/sendata?did=${doctor.id}&deptId=${sdepartment.deptId}&sid=${sdepartment.id}&tid=${t.id}'">上午<br>${fn:substring(t.startTimes,11,16)}
                                            - ${fn:substring(t.endTime,11,16)}</button></td>
                                    </c:if>
                                </c:forEach>
                                <c:if test="${flag}">
                                    <td></td>
                                </c:if>
                            </c:if>
                        </c:forEach>

                    </tbody>
                </table>
            </div>

        </div>


        <!-- 评论 -->
        <div style="margin-top:40px; width: 1000px; margin-left: 500px;" id="123456">
            <ul class="nav nav-tabs">
                <li id="li1" style="color:rgb(151, 161, 92);"><h2>评价</h2></li>
            </ul>
            <div class="box" id="box1">
                <div class="row" style="margin-top:20px;">
                    <c:forEach items="${pageInfo.list}" var="com">
                    <div class="col-md-10">
                        <span style="font-size:18px;"><b>${com.username}</b></span>&nbsp;&nbsp;
                        <span> 评论时间：${com.createTime}</span>
                        <br>
                        <span>${com.comment}</span>
                    </div>
                    </c:forEach>
                </div>
            </div>
        </div>
        </div>
        </div>   <!-- div2 -->
        </div>
        </div>
        <!-- 评论end-->
    </div>

    <!--底部地址栏begin-->
<br>
<br>
<br>
<br>
<br>
<br><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<%@ include file="../nav/foot.jsp"%>

    <!--底部地址栏begin-->



    <script src="plugins/jquery/jquery.min.js"></script>
    <!--引入bootstrap的js文件-->
    <script src="plugins/bootstrap/js/bootstrap.js"></script>

    <script>
        window.onload = function(){
            var arr = document.getElementsByTagName('b');
            for(var i = 0;i<arr.length;i++){
                arr[i].onclick = function(){
                    if(this.id =='1'){
                        document.getElementById("box1").style.display = 'block';
                        document.getElementById("box2").style.display = 'none';
                        document.getElementById("li2").className='#';
                        document.getElementById("li1").className='active';
                    }
                    if(this.id =='2'){
                        document.getElementById("box1").style.display = 'none';
                        document.getElementById("box2").style.display = 'block';
                        document.getElementById("li2").className='active';
                        document.getElementById("li1").className='#';
                    }
                    //this是激活当前按钮
                    if(this.className =='btn1'){
                        this.className =='btn2';
                        var name = this.id;
                        var btn = document.getElementsByClassName('btn2');
                        for(var j = 0;j<btn.length;j++){
                            if(btn[j].id!=name){
                                btn[j].className='btn1';
                            }
                        }
                    }
                }
            }
        }
    </script>
</body>

</html>